from multiprocessing import Process, Queue

class MyProcess(Process):
    def __init__(self, name, queue):
        super().__init__()
        self.name = name
        self.queue = queue

    def run(self):
        print(f'子进程{self.name}启动')
        a = self.queue.get()  # 从队列中获取数据
        print(a)

if __name__ == '__main__':
    mq = Queue()
    mq.put('1')
    mq.put('2')
    mq.put('3')

    p1 = MyProcess('进程1', mq)
    p2 = MyProcess('进程2', mq)
    p3 = MyProcess('进程3', mq)
    p1.start()
    p2.start()
    p3.start()